<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #box1 {
            width: 200px;
            height: 200px;
            background: blue;
        }

        #box2 {
            width: 100px;
            height: 100px;
            background: red;
        }

        #box3 {
            width: 50px;
            height: 50px;
            background: white;
        }
    </style>
</head>

<body>
    <div id="box1">
        <div id="box2">
            <div id="box3"></div>
        </div>
    </div>
    <script>
        let box1 = document.getElementById('box1')
        let box2 = document.getElementById('box2')
        let box3 = document.getElementById('box3')
        box1.onclick = function () {
            console.log('box1');
        }
        box2.onclick = function () {
            console.log('box2');
        }
        box3.onclick = function () {
            console.log('box3');
        }
    </script>

</body>

</html>